namespace EduModel.Migrations
{
    using System;
    using System.Data.Entity.Migrations;
    
    public partial class InitialCreate : DbMigration
    {
        public override void Up()
        {
            CreateTable(
                "dbo.C_Exe",
                c => new
                    {
                        ExeId = c.Int(nullable: false),
                        ExeStem = c.String(),
                        ExeType = c.Int(),
                        SubType = c.Int(),
                        OptionNum = c.Int(),
                        Option1 = c.String(maxLength: 1000),
                        Option2 = c.String(maxLength: 1000),
                        Option3 = c.String(maxLength: 1000),
                        Option4 = c.String(maxLength: 1000),
                        Option5 = c.String(maxLength: 1000),
                        Option6 = c.String(maxLength: 1000),
                        Option7 = c.String(maxLength: 1000),
                        Option8 = c.String(maxLength: 1000),
                        RightAn = c.String(maxLength: 50, unicode: false),
                        ExeRemark = c.String(),
                        ExeId_P = c.Int(),
                        StudyId = c.Int(),
                        GradeId = c.Int(),
                        SmallPath = c.String(maxLength: 1000),
                    })
                .PrimaryKey(t => t.ExeId);
            
            CreateTable(
                "dbo.C_Paper",
                c => new
                    {
                        PaperId = c.Int(nullable: false),
                        PaperName = c.String(maxLength: 200),
                        PaperSource = c.String(maxLength: 200),
                        ExeNumSum = c.Int(),
                        PaperTime = c.Int(),
                        PaperState = c.Int(),
                        CreateUserId = c.Int(),
                        CreateTime = c.DateTime(),
                        StudyId = c.Int(),
                        StageId = c.Int(),
                        GradeId = c.Int(),
                        PaperType = c.Int(),
                        Sort = c.Int(),
                    })
                .PrimaryKey(t => t.PaperId);
            
            CreateTable(
                "dbo.C_PaperExe",
                c => new
                    {
                        PaperId = c.Int(nullable: false),
                        ExeId = c.Int(nullable: false),
                    })
                .PrimaryKey(t => new { t.PaperId, t.ExeId });
            
            CreateTable(
                "dbo.C_Test",
                c => new
                    {
                        TestId = c.Int(nullable: false, identity: true),
                        UserId = c.Int(),
                        PaperId = c.Int(),
                        ExeNumSum = c.Int(),
                        ExeNumRight = c.Int(),
                        SubmitTime = c.DateTime(),
                        ScoreSum = c.Decimal(precision: 8, scale: 2),
                    })
                .PrimaryKey(t => t.TestId);
            
            CreateTable(
                "dbo.C_TestError",
                c => new
                    {
                        UserId = c.Int(nullable: false),
                        ExeId = c.Int(nullable: false),
                        ErrorCount = c.Int(),
                        TestCount = c.Int(),
                    })
                .PrimaryKey(t => new { t.UserId, t.ExeId });
            
            CreateTable(
                "dbo.C_TestList",
                c => new
                    {
                        TestId = c.Int(nullable: false),
                        ExeId = c.Int(nullable: false),
                        MyAn = c.String(maxLength: 50, unicode: false),
                        IsRight = c.Boolean(),
                    })
                .PrimaryKey(t => new { t.TestId, t.ExeId });
            
            CreateTable(
                "dbo.M_MathExercise",
                c => new
                    {
                        ExerciseId = c.Int(nullable: false, identity: true),
                        MathExeTypeId = c.Int(nullable: false),
                        UserId = c.Int(nullable: false),
                        TimeLen = c.Int(nullable: false),
                        ExeCnt = c.Int(nullable: false),
                        ErrCnt = c.Int(nullable: false),
                        RightCnt = c.Int(nullable: false),
                        Score = c.Int(nullable: false),
                        AddTime = c.DateTime(nullable: false),
                    })
                .PrimaryKey(t => t.ExerciseId);
            
            CreateTable(
                "dbo.M_MathExeType",
                c => new
                    {
                        MathExeTypeId = c.Int(nullable: false, identity: true),
                        MathLevelId = c.Int(nullable: false),
                        MathExeType = c.String(nullable: false, maxLength: 200),
                        Method = c.String(nullable: false, maxLength: 50),
                        ResultMax = c.Double(nullable: false),
                    })
                .PrimaryKey(t => t.MathExeTypeId);
            
            CreateTable(
                "dbo.M_MathHomeWork",
                c => new
                    {
                        HomeWorkId = c.Int(nullable: false, identity: true),
                        MathExeTypeId = c.Int(nullable: false),
                        ExeCnt = c.Int(nullable: false),
                        UserId = c.Int(nullable: false),
                        ClassIds = c.String(maxLength: 50),
                        TermId = c.Int(nullable: false),
                        AddTime = c.DateTime(nullable: false),
                    })
                .PrimaryKey(t => t.HomeWorkId);
            
            CreateTable(
                "dbo.M_MathHomeWorkReceive",
                c => new
                    {
                        HomeWordReceiveId = c.Int(nullable: false, identity: true),
                        HomeWorkId = c.Int(nullable: false),
                        UserId = c.Int(nullable: false),
                        IsFlag = c.Int(nullable: false),
                        AddTime = c.DateTime(),
                        M_MathHomeWorkReceive2_HomeWordReceiveId = c.Int(nullable: false),
                    })
                .PrimaryKey(t => t.HomeWordReceiveId)
                .ForeignKey("dbo.M_MathHomeWorkReceive", t => t.M_MathHomeWorkReceive2_HomeWordReceiveId)
                .Index(t => t.M_MathHomeWorkReceive2_HomeWordReceiveId);
            
            CreateTable(
                "dbo.M_MathHomeWorkResult",
                c => new
                    {
                        MathResultId = c.Int(nullable: false, identity: true),
                        HomeWorkId = c.Int(nullable: false),
                        UserId = c.Int(nullable: false),
                        TimeLen = c.Int(nullable: false),
                        ExeCnt = c.Int(nullable: false),
                        ErrCnt = c.Int(nullable: false),
                        RightCnt = c.Int(nullable: false),
                        Score = c.Int(nullable: false),
                        AddTime = c.DateTime(nullable: false),
                    })
                .PrimaryKey(t => t.MathResultId);
            
            CreateTable(
                "dbo.M_MathLevel",
                c => new
                    {
                        MathLevelId = c.Int(nullable: false),
                        MathLevel = c.String(maxLength: 200),
                        GradeId = c.Int(),
                    })
                .PrimaryKey(t => t.MathLevelId);
            
            CreateTable(
                "dbo.R_LiveCourse",
                c => new
                    {
                        LiveCourseId = c.Int(nullable: false, identity: true),
                        CourseName = c.String(maxLength: 100),
                        UserId = c.Int(nullable: false),
                        SchoolId = c.Int(nullable: false),
                        LiveRoomId = c.Int(nullable: false),
                        StudyId = c.Int(),
                        GradeId = c.Int(),
                        ClassId = c.Int(),
                        TimeStart = c.DateTime(nullable: false),
                        TimeEnd = c.DateTime(nullable: false),
                        Description = c.String(maxLength: 4000),
                        ISLive = c.Int(),
                    })
                .PrimaryKey(t => t.LiveCourseId);
            
            CreateTable(
                "dbo.R_LiveRoom",
                c => new
                    {
                        LiveRoomId = c.Int(nullable: false, identity: true),
                        LiveRoomName = c.String(maxLength: 100),
                        LiveRoomUrl = c.String(maxLength: 1000),
                        SchoolId = c.Int(nullable: false),
                    })
                .PrimaryKey(t => t.LiveRoomId);
            
            CreateTable(
                "dbo.R_MatCheckList",
                c => new
                    {
                        CheckListId = c.Int(nullable: false, identity: true),
                        UserId = c.Int(),
                        SchoolId = c.Int(),
                        TimeCheck = c.DateTime(),
                    })
                .PrimaryKey(t => t.CheckListId);
            
            CreateTable(
                "dbo.R_MatCollection",
                c => new
                    {
                        CollectionId = c.Int(nullable: false, identity: true),
                        MatId = c.Int(nullable: false),
                        UserId = c.Int(nullable: false),
                        RoleId = c.Int(nullable: false),
                        TimeCreate = c.DateTime(nullable: false),
                    })
                .PrimaryKey(t => t.CollectionId);
            
            CreateTable(
                "dbo.R_MatFile",
                c => new
                    {
                        MatId = c.Int(nullable: false, identity: true),
                        UserId = c.Int(nullable: false),
                        SchoolId = c.Int(nullable: false),
                        StageId = c.Int(nullable: false),
                        StudyId = c.Int(nullable: false),
                        VersionId = c.Int(nullable: false),
                        GradeId = c.Int(nullable: false),
                        VolumeId = c.Long(nullable: false),
                        UnitId = c.Long(nullable: false),
                        LessonId = c.Long(nullable: false),
                        MatTitle = c.String(nullable: false, maxLength: 200),
                        MatTypeId = c.Int(nullable: false),
                        SourceType = c.Int(nullable: false),
                        OpenRange = c.Int(nullable: false),
                        FlagSchool = c.Int(nullable: false),
                        FlagArea = c.Int(nullable: false),
                        MatPath = c.String(maxLength: 500),
                        MatSize = c.Int(nullable: false),
                        MatExtId = c.Int(),
                        KeyWord = c.String(maxLength: 500),
                        MatDes = c.String(),
                        TimeCreate = c.DateTime(nullable: false),
                        LookCnt = c.Int(nullable: false),
                        StarCnt = c.Int(nullable: false),
                        FileCutImg = c.String(maxLength: 500),
                        FileConvert = c.String(maxLength: 500),
                        FileConvertTime = c.DateTime(),
                        ConvertNum = c.Int(),
                        ConvertHead = c.Int(),
                        PrelectObject = c.String(maxLength: 2000),
                        lecturePro = c.String(maxLength: 50),
                    })
                .PrimaryKey(t => t.MatId);
            
            CreateTable(
                "dbo.R_MatFileExt",
                c => new
                    {
                        FileExtId = c.Int(nullable: false),
                        FileExtName = c.String(maxLength: 50, unicode: false),
                        FileTypeId = c.Int(),
                        FileTypeName = c.String(maxLength: 50, unicode: false),
                        CanConvert = c.Int(),
                    })
                .PrimaryKey(t => t.FileExtId);
            
            CreateTable(
                "dbo.R_MatForum",
                c => new
                    {
                        ForumId = c.Int(nullable: false, identity: true),
                        MatId = c.Int(nullable: false),
                        ForumStar = c.Int(nullable: false),
                        UserId = c.Int(),
                        RoleId = c.Int(),
                        TimeForum = c.DateTime(nullable: false),
                    })
                .PrimaryKey(t => t.ForumId);
            
            CreateTable(
                "dbo.R_MatSchoolFTP",
                c => new
                    {
                        FtpId = c.Int(nullable: false, identity: true),
                        FtpUrl = c.String(maxLength: 200),
                        HttpUrl = c.String(maxLength: 200),
                        FtpUserName = c.String(maxLength: 200),
                        FtpPwd = c.String(maxLength: 200),
                        SchoolId = c.Int(nullable: false),
                    })
                .PrimaryKey(t => t.FtpId);
            
            CreateTable(
                "dbo.R_MatSetCheck",
                c => new
                    {
                        CheckID = c.Int(nullable: false),
                        OpenRange = c.String(maxLength: 50),
                        FlagSchool = c.Int(),
                        FlagArea = c.Int(),
                    })
                .PrimaryKey(t => t.CheckID);
            
            CreateTable(
                "dbo.R_MatTeaCheck",
                c => new
                    {
                        TeaCheckId = c.Int(nullable: false, identity: true),
                        UserId = c.Int(nullable: false),
                        StudyId = c.Int(nullable: false),
                        GradeId = c.Int(nullable: false),
                    })
                .PrimaryKey(t => t.TeaCheckId);
            
            CreateTable(
                "dbo.R_MatTeaIsCheck",
                c => new
                    {
                        UserId = c.Int(nullable: false),
                        TeaIsCheckId = c.Int(nullable: false, identity: true),
                    })
                .PrimaryKey(t => t.UserId);
            
            CreateTable(
                "dbo.R_MatType",
                c => new
                    {
                        MatTypeId = c.Int(nullable: false, identity: true),
                        MatTypeName = c.String(maxLength: 20),
                        CoverImg = c.String(maxLength: 50, unicode: false),
                    })
                .PrimaryKey(t => t.MatTypeId);
            
            CreateTable(
                "dbo.T_App",
                c => new
                    {
                        AppId = c.Int(nullable: false),
                        AppName = c.String(maxLength: 100),
                        AppCode = c.String(maxLength: 100, unicode: false),
                    })
                .PrimaryKey(t => t.AppId);
            
            CreateTable(
                "dbo.T_AppModelOpen",
                c => new
                    {
                        SchoolId = c.Int(nullable: false),
                        TimeBegin = c.DateTime(nullable: false),
                        TimeEnd = c.DateTime(nullable: false),
                    })
                .PrimaryKey(t => new { t.SchoolId, t.TimeBegin, t.TimeEnd });
            
            CreateTable(
                "dbo.T_AppTicket",
                c => new
                    {
                        UserId = c.Int(nullable: false),
                        AppTicket = c.String(maxLength: 200, unicode: false),
                        LoginTime = c.DateTime(),
                        JiGuangId = c.String(maxLength: 500),
                    })
                .PrimaryKey(t => t.UserId);
            
            CreateTable(
                "dbo.T_Area",
                c => new
                    {
                        AreaCode = c.String(nullable: false, maxLength: 10, unicode: false),
                        AreaName = c.String(maxLength: 50),
                        CityCode = c.String(maxLength: 10, unicode: false),
                        SysUrl = c.String(maxLength: 500, unicode: false),
                        OpenReg = c.Int(),
                    })
                .PrimaryKey(t => t.AreaCode);
            
            CreateTable(
                "dbo.T_AwardMat",
                c => new
                    {
                        MatId = c.Int(nullable: false, identity: true),
                        MatName = c.String(maxLength: 100),
                        Sore = c.Decimal(precision: 8, scale: 1),
                        SchoolId = c.Int(),
                    })
                .PrimaryKey(t => t.MatId);
            
            CreateTable(
                "dbo.T_AwardRecord",
                c => new
                    {
                        RecordId = c.Int(nullable: false, identity: true),
                        MatId = c.Int(),
                        Score = c.Decimal(precision: 8, scale: 1),
                        UpUserId = c.Int(),
                        UpTime = c.DateTime(),
                        OperState = c.Int(),
                        OperUserId = c.Int(),
                        OperTime = c.DateTime(),
                    })
                .PrimaryKey(t => t.RecordId);
            
            CreateTable(
                "dbo.T_CashMat",
                c => new
                    {
                        MatId = c.Int(nullable: false, identity: true),
                        MatName = c.String(maxLength: 100),
                        MatImg = c.String(maxLength: 1000),
                        MatRemark = c.String(maxLength: 1000),
                        MatScore = c.Decimal(precision: 8, scale: 1),
                        MatNum = c.Decimal(precision: 8, scale: 1),
                        MatState = c.Int(),
                        RoleTypeId = c.Int(),
                    })
                .PrimaryKey(t => t.MatId);
            
            CreateTable(
                "dbo.T_CashRecord",
                c => new
                    {
                        RecordId = c.Int(nullable: false, identity: true),
                        UserId = c.Int(),
                        MatId = c.Int(),
                        SchoolId = c.Int(),
                        GradeId = c.Int(),
                        ClassId = c.Int(),
                        Score = c.Decimal(precision: 8, scale: 1),
                        CreateTime = c.DateTime(),
                        CashTime = c.DateTime(),
                        CashState = c.Int(),
                    })
                .PrimaryKey(t => t.RecordId);
            
            CreateTable(
                "dbo.T_City",
                c => new
                    {
                        CityCode = c.String(nullable: false, maxLength: 10, unicode: false),
                        CityName = c.String(maxLength: 50),
                        ProvCode = c.String(maxLength: 10, unicode: false),
                        SysUrl = c.String(maxLength: 500, unicode: false),
                    })
                .PrimaryKey(t => t.CityCode);
            
            CreateTable(
                "dbo.T_Class",
                c => new
                    {
                        ClassId = c.Int(nullable: false, identity: true),
                        ClassName = c.String(maxLength: 50, unicode: false),
                        GradeId = c.Int(nullable: false),
                        SchoolId = c.Int(nullable: false),
                        ClassIdP = c.Int(),
                        ClassSort = c.Int(),
                    })
                .PrimaryKey(t => t.ClassId);
            
            CreateTable(
                "dbo.T_ClassGroup",
                c => new
                    {
                        GroupId = c.Int(nullable: false, identity: true),
                        GroupName = c.String(maxLength: 100),
                        SchoolId = c.Int(),
                        GradeId = c.Int(),
                        ClassId = c.Int(),
                    })
                .PrimaryKey(t => t.GroupId);
            
            CreateTable(
                "dbo.T_ClassGroupStudent",
                c => new
                    {
                        GroupId = c.Int(nullable: false),
                        UserId = c.Int(nullable: false),
                    })
                .PrimaryKey(t => new { t.GroupId, t.UserId });
            
            CreateTable(
                "dbo.T_ClassStudent",
                c => new
                    {
                        ClassId = c.Int(nullable: false),
                        UserId = c.Int(nullable: false),
                    })
                .PrimaryKey(t => new { t.ClassId, t.UserId });
            
            CreateTable(
                "dbo.T_ClassTerm",
                c => new
                    {
                        TermId = c.Int(nullable: false),
                        ClassId = c.Int(nullable: false),
                    })
                .PrimaryKey(t => new { t.TermId, t.ClassId });
            
            CreateTable(
                "dbo.T_FileType",
                c => new
                    {
                        FileExtId = c.Int(nullable: false),
                        FileExtName = c.String(maxLength: 50, unicode: false),
                        FileTypeId = c.Int(),
                        FileTypeName = c.String(maxLength: 50, unicode: false),
                        CanConvert = c.Int(),
                    })
                .PrimaryKey(t => t.FileExtId);
            
            CreateTable(
                "dbo.T_Group",
                c => new
                    {
                        GroupId = c.Int(nullable: false, identity: true),
                        GroupName = c.String(maxLength: 500),
                    })
                .PrimaryKey(t => t.GroupId);
            
            CreateTable(
                "dbo.T_Journalism",
                c => new
                    {
                        JourId = c.Int(nullable: false, identity: true),
                        Title = c.String(maxLength: 500),
                        UserId = c.Int(),
                        Content = c.String(),
                        Paper = c.String(maxLength: 500),
                        Link = c.String(maxLength: 1000),
                        TimeCreate = c.DateTime(),
                        FilePath = c.String(maxLength: 500),
                        SchoolId = c.Int(),
                    })
                .PrimaryKey(t => t.JourId);
            
            CreateTable(
                "dbo.T_KeyValue",
                c => new
                    {
                        DictKey = c.String(nullable: false, maxLength: 100),
                        DictValue = c.String(maxLength: 100),
                        Remark = c.String(maxLength: 500),
                        AppId = c.Int(),
                    })
                .PrimaryKey(t => t.DictKey);
            
            CreateTable(
                "dbo.T_Leave",
                c => new
                    {
                        LId = c.Int(nullable: false, identity: true),
                        LeaveDate = c.DateTime(),
                        Reason = c.String(maxLength: 10, unicode: false),
                        UserId = c.Int(),
                        UserName = c.String(maxLength: 50, unicode: false),
                        Audit = c.Int(),
                        ClassId = c.Int(),
                        SchoolId = c.Int(),
                    })
                .PrimaryKey(t => t.LId);
            
            CreateTable(
                "dbo.T_MakeList",
                c => new
                    {
                        MakeId = c.Int(nullable: false, identity: true),
                        SchoolId = c.Int(),
                        WorkType = c.Int(),
                        CreateTime = c.DateTime(),
                    })
                .PrimaryKey(t => t.MakeId);
            
            CreateTable(
                "dbo.T_ManageSchool",
                c => new
                    {
                        UserId = c.Int(nullable: false),
                        SchoolId = c.Int(nullable: false),
                    })
                .PrimaryKey(t => new { t.UserId, t.SchoolId });
            
            CreateTable(
                "dbo.T_MaxId",
                c => new
                    {
                        BuName = c.String(nullable: false, maxLength: 10, unicode: false),
                        MaxId = c.Int(),
                        Remark = c.String(maxLength: 200),
                    })
                .PrimaryKey(t => t.BuName);
            
            CreateTable(
                "dbo.T_Msg",
                c => new
                    {
                        MsgId = c.Int(nullable: false, identity: true),
                        MsgType = c.Int(),
                        MsgTitle = c.String(maxLength: 200),
                        MsgContent = c.String(),
                        UserId = c.Int(),
                        CreateTime = c.DateTime(),
                    })
                .PrimaryKey(t => t.MsgId);
            
            CreateTable(
                "dbo.T_MsgFile",
                c => new
                    {
                        FileId = c.Int(nullable: false, identity: true),
                        FileType = c.Int(),
                        FilePath = c.String(maxLength: 500),
                        FilePathImg = c.String(maxLength: 500),
                        FileName = c.String(maxLength: 500),
                        AudioLong = c.Int(),
                        MsgId = c.Int(),
                    })
                .PrimaryKey(t => t.FileId);
            
            CreateTable(
                "dbo.T_MsgReceive",
                c => new
                    {
                        ReceiveId = c.Int(nullable: false, identity: true),
                        UserId = c.Int(),
                        LookState = c.Boolean(),
                        LookTime = c.DateTime(),
                        MsgId = c.Int(),
                    })
                .PrimaryKey(t => t.ReceiveId);
            
            CreateTable(
                "dbo.T_MsgReply",
                c => new
                    {
                        ReplyId = c.Int(nullable: false, identity: true),
                        MsgId = c.Int(),
                        UserId = c.Int(),
                        ReplyContent = c.String(),
                        CreateTime = c.DateTime(),
                        ReplyToReplyId = c.Int(),
                        ReplyToUserId = c.Int(),
                    })
                .PrimaryKey(t => t.ReplyId);
            
            CreateTable(
                "dbo.T_MsgReplyFile",
                c => new
                    {
                        FileId = c.Int(nullable: false, identity: true),
                        FileType = c.Int(),
                        FilePath = c.String(maxLength: 500),
                        FilePathImg = c.String(maxLength: 500),
                        FileName = c.String(maxLength: 500),
                        AudioLong = c.Int(),
                        ReplyId = c.Int(),
                    })
                .PrimaryKey(t => t.FileId);
            
            CreateTable(
                "dbo.T_New",
                c => new
                    {
                        NewId = c.Int(nullable: false, identity: true),
                        NewTitle = c.String(maxLength: 500),
                        NewImg = c.String(maxLength: 500),
                        NewPaper = c.String(maxLength: 500),
                        NewContent = c.String(),
                        NewLink = c.String(maxLength: 1000),
                        MainTypeId = c.Int(),
                        SubTypeId = c.Int(),
                        SchoolId = c.Int(),
                        UserId = c.Int(),
                        CreateTime = c.DateTime(),
                    })
                .PrimaryKey(t => t.NewId);
            
            CreateTable(
                "dbo.T_PayOrder",
                c => new
                    {
                        OrderNo = c.String(nullable: false, maxLength: 40, unicode: false),
                        OrderSort = c.Int(),
                        OrderTime = c.DateTime(),
                        UserId = c.Int(),
                        PayPrice = c.Decimal(precision: 8, scale: 2),
                        UseDays = c.Int(),
                        UseTimeBegin = c.DateTime(),
                        UseTimeEnd = c.DateTime(),
                        TradeType = c.Int(),
                        TradeStatus = c.Int(),
                        TradeNo = c.String(maxLength: 100, unicode: false),
                        TradeCreateTime = c.DateTime(),
                        TradeNotifyTime = c.DateTime(),
                        Phone = c.String(maxLength: 50, unicode: false),
                    })
                .PrimaryKey(t => t.OrderNo);
            
            CreateTable(
                "dbo.T_Post",
                c => new
                    {
                        PostId = c.Int(nullable: false, identity: true),
                        PostUserId = c.Int(),
                        PostContent = c.String(maxLength: 4000),
                        StandId = c.Int(),
                        ClassId = c.Int(),
                        GradeId = c.Int(),
                        SchoolId = c.Int(),
                        AgreeCnt = c.Int(),
                        CmtCnt = c.Int(),
                        CreateTime = c.DateTime(),
                        ScoreTypeId = c.Int(),
                        OperId = c.Int(),
                        Audit = c.Int(),
                    })
                .PrimaryKey(t => t.PostId);
            
            CreateTable(
                "dbo.T_PostAgree",
                c => new
                    {
                        PostId = c.Int(nullable: false),
                        UserId = c.Int(nullable: false),
                        CreateTime = c.DateTime(nullable: false),
                    })
                .PrimaryKey(t => new { t.PostId, t.UserId });
            
            CreateTable(
                "dbo.T_PostFile",
                c => new
                    {
                        FileId = c.Int(nullable: false, identity: true),
                        FileType = c.Int(),
                        FileName = c.String(maxLength: 500),
                        FilePath = c.String(maxLength: 500),
                        FilePathImg = c.String(maxLength: 500),
                        AudioLong = c.Int(),
                        PostId = c.Int(),
                    })
                .PrimaryKey(t => t.FileId);
            
            CreateTable(
                "dbo.T_PostReply",
                c => new
                    {
                        ReplyId = c.Int(nullable: false, identity: true),
                        ReplyUserId = c.Int(),
                        ReplyContent = c.String(maxLength: 4000),
                        PostId = c.Int(),
                        CreateTime = c.DateTime(),
                        ReplyToReplyId = c.Int(),
                        ReplyToUserId = c.Int(),
                    })
                .PrimaryKey(t => t.ReplyId);
            
            CreateTable(
                "dbo.T_PostReplyFile",
                c => new
                    {
                        FileId = c.Int(nullable: false, identity: true),
                        FileType = c.Int(),
                        FileName = c.String(maxLength: 500),
                        FilePath = c.String(maxLength: 500),
                        FilePathImg = c.String(maxLength: 500),
                        AudioLong = c.Int(),
                        ReplyId = c.Int(),
                    })
                .PrimaryKey(t => t.FileId);
            
            CreateTable(
                "dbo.T_Prov",
                c => new
                    {
                        ProvCode = c.String(nullable: false, maxLength: 10, unicode: false),
                        ProvName = c.String(maxLength: 50),
                        SysUrl = c.String(maxLength: 500, unicode: false),
                    })
                .PrimaryKey(t => t.ProvCode);
            
            CreateTable(
                "dbo.T_Recipes",
                c => new
                    {
                        RId = c.Int(nullable: false, identity: true),
                        SchoolId = c.Int(nullable: false),
                        CreateTime = c.DateTime(),
                        BeginTime = c.DateTime(),
                        EndTime = c.DateTime(),
                        Content = c.String(maxLength: 500),
                        UserId = c.Int(),
                    })
                .PrimaryKey(t => t.RId);
            
            CreateTable(
                "dbo.T_Recipes_Img",
                c => new
                    {
                        MId = c.Int(nullable: false, identity: true),
                        RId = c.Int(),
                        ReImg = c.String(maxLength: 200),
                        ReImgPath = c.String(maxLength: 200),
                    })
                .PrimaryKey(t => t.MId);
            
            CreateTable(
                "dbo.T_RecrPlan",
                c => new
                    {
                        RId = c.Int(nullable: false, identity: true),
                        Content = c.String(),
                        SchoolId = c.Int(),
                    })
                .PrimaryKey(t => t.RId);
            
            CreateTable(
                "dbo.T_Role",
                c => new
                    {
                        RoleId = c.Int(nullable: false),
                        RoleName = c.String(maxLength: 50),
                    })
                .PrimaryKey(t => t.RoleId);
            
            CreateTable(
                "dbo.T_School",
                c => new
                    {
                        SchoolId = c.Int(nullable: false, identity: true),
                        SchoolName = c.String(maxLength: 100),
                        SchoolTypeId = c.Int(),
                        SchoolCode = c.String(maxLength: 50, unicode: false),
                        SchoolInfo = c.String(maxLength: 2000),
                        AreaCode = c.String(maxLength: 10),
                        GroupId = c.Int(),
                        ComeImg = c.String(maxLength: 1000),
                        GoImg = c.String(maxLength: 1000),
                        MsgChannel = c.Int(),
                        LinkQQ = c.String(maxLength: 500, unicode: false),
                        LinkPhone = c.String(maxLength: 500, unicode: false),
                        OperModel = c.Int(),
                        ComeCode = c.String(maxLength: 1000),
                        GoCode = c.String(maxLength: 1000),
                        SendMsgTimes = c.Int(),
                        SendNoticeSMS = c.Int(),
                        IsMonth = c.Int(),
                        MonthCost = c.Decimal(precision: 18, scale: 2),
                        IsYear = c.Int(),
                        YearCost = c.Decimal(precision: 18, scale: 2),
                        ZMonth = c.Int(),
                        ZYear = c.Int(),
                        PMonth = c.Int(),
                        PYear = c.Int(),
                        SMonth = c.Int(),
                        SYear = c.Int(),
                        Audit = c.Int(),
                        StuAudit = c.Int(),
                    })
                .PrimaryKey(t => t.SchoolId);
            
            CreateTable(
                "dbo.T_School_WorkFun",
                c => new
                    {
                        SchoolId = c.Int(nullable: false),
                        RoleId = c.Int(nullable: false),
                        FunId = c.Int(),
                    })
                .PrimaryKey(t => new { t.SchoolId, t.RoleId });
            
            CreateTable(
                "dbo.T_SchoolBackImg",
                c => new
                    {
                        SchoolId = c.Int(nullable: false),
                        BackImg = c.String(maxLength: 500),
                    })
                .PrimaryKey(t => t.SchoolId);
            
            CreateTable(
                "dbo.T_SchoolStyle",
                c => new
                    {
                        SId = c.Int(nullable: false, identity: true),
                        Title = c.String(maxLength: 50, unicode: false),
                        SchoolId = c.Int(),
                    })
                .PrimaryKey(t => t.SId);
            
            CreateTable(
                "dbo.T_SchoolStylePhoto",
                c => new
                    {
                        PId = c.Int(nullable: false, identity: true),
                        SId = c.Int(nullable: false),
                        ImgPath = c.String(maxLength: 200),
                        ImgThumbPath = c.String(maxLength: 200),
                        UserId = c.Int(nullable: false),
                    })
                .PrimaryKey(t => t.PId);
            
            CreateTable(
                "dbo.T_SchoolType",
                c => new
                    {
                        SchoolTypeId = c.Int(nullable: false),
                        SchoolTypeName = c.String(maxLength: 50),
                        Sort = c.Int(),
                    })
                .PrimaryKey(t => t.SchoolTypeId);
            
            CreateTable(
                "dbo.T_SchoolTypeStage",
                c => new
                    {
                        SchoolTypeId = c.Int(nullable: false),
                        StageId = c.Int(nullable: false),
                    })
                .PrimaryKey(t => new { t.SchoolTypeId, t.StageId });
            
            CreateTable(
                "dbo.T_ScoreRecord",
                c => new
                    {
                        RecordId = c.Int(nullable: false, identity: true),
                        UserId = c.Int(),
                        ScoreFlow = c.Int(),
                        ScoreTypeId = c.Int(),
                        Score = c.Decimal(precision: 8, scale: 1),
                        ScoreCur = c.Decimal(precision: 8, scale: 1),
                        CreateTime = c.DateTime(),
                        RefId = c.Int(),
                    })
                .PrimaryKey(t => t.RecordId);
            
            CreateTable(
                "dbo.T_ScoreRecordUser",
                c => new
                    {
                        UserId = c.Int(nullable: false),
                        AppId = c.Int(nullable: false),
                        ScorePlus = c.Decimal(precision: 8, scale: 1),
                    })
                .PrimaryKey(t => new { t.UserId, t.AppId });
            
            CreateTable(
                "dbo.T_ScoreType",
                c => new
                    {
                        ScoreTypeId = c.Int(nullable: false),
                        ScoreTypeName = c.String(maxLength: 100),
                        ScoreTypeDesc = c.String(maxLength: 1000),
                        AppId = c.Int(),
                    })
                .PrimaryKey(t => t.ScoreTypeId);
            
            CreateTable(
                "dbo.T_Stand",
                c => new
                    {
                        StandId = c.Int(nullable: false, identity: true),
                        StandType = c.Int(),
                        StandName = c.String(maxLength: 500),
                        CheckRole = c.Int(),
                        Score = c.Decimal(precision: 8, scale: 1),
                        Sort = c.Int(),
                        StandState = c.Boolean(),
                        SchoolId = c.Int(),
                    })
                .PrimaryKey(t => t.StandId);
            
            CreateTable(
                "dbo.T_StandRecord",
                c => new
                    {
                        RecordId = c.Int(nullable: false, identity: true),
                        UserId = c.Int(),
                        StandId = c.Int(),
                        Score = c.Decimal(precision: 8, scale: 1),
                        CreateTime = c.DateTime(),
                        CheckUserId = c.Int(),
                    })
                .PrimaryKey(t => t.RecordId);
            
            CreateTable(
                "dbo.T_StarBabyMsg",
                c => new
                    {
                        MsgId = c.Int(nullable: false, identity: true),
                        MsgType = c.Int(),
                        UserId = c.String(maxLength: 10, fixedLength: true),
                        MsgContent = c.String(maxLength: 4000),
                        CreateTime = c.DateTime(),
                        BeginTime = c.DateTime(),
                        EndTime = c.DateTime(),
                        ClassId = c.Int(),
                    })
                .PrimaryKey(t => t.MsgId);
            
            CreateTable(
                "dbo.T_StarBabyMsgFile",
                c => new
                    {
                        FileId = c.Int(nullable: false, identity: true),
                        FilePath = c.String(maxLength: 500),
                        FilePathImg = c.String(maxLength: 500),
                        FileName = c.String(maxLength: 500),
                        MsgId = c.Int(),
                    })
                .PrimaryKey(t => t.FileId);
            
            CreateTable(
                "dbo.T_StarBabyMsgReceive",
                c => new
                    {
                        ReceiveId = c.Int(nullable: false, identity: true),
                        UserId = c.Int(nullable: false),
                        MsgId = c.Int(nullable: false),
                    })
                .PrimaryKey(t => t.ReceiveId);
            
            CreateTable(
                "dbo.T_StarBabyType",
                c => new
                    {
                        SID = c.Int(nullable: false, identity: true),
                        StarTypeName = c.String(maxLength: 50, unicode: false),
                        UserId = c.Int(),
                        SchoolId = c.Int(),
                    })
                .PrimaryKey(t => t.SID);
            
            CreateTable(
                "dbo.T_StuContacts",
                c => new
                    {
                        SId = c.Int(nullable: false, identity: true),
                        StuName = c.String(maxLength: 50, unicode: false),
                        ClassId = c.Int(),
                        FTelPhone = c.String(maxLength: 50, unicode: false),
                        MTelPhone = c.String(maxLength: 50, unicode: false),
                        OTelPhone = c.String(maxLength: 50, unicode: false),
                        SchoolId = c.Int(),
                    })
                .PrimaryKey(t => t.SId);
            
            CreateTable(
                "dbo.T_Synopsis",
                c => new
                    {
                        sysId = c.Int(nullable: false, identity: true),
                        synopsis = c.String(),
                        Phone = c.String(maxLength: 200),
                        FilePath = c.String(maxLength: 1000),
                        SchoolId = c.Int(),
                        Name = c.String(maxLength: 200),
                    })
                .PrimaryKey(t => t.sysId);
            
            CreateTable(
                "dbo.T_TeachClass",
                c => new
                    {
                        TermId = c.Int(nullable: false),
                        UserId = c.Int(nullable: false),
                        StudyId = c.Int(nullable: false),
                        GradeId = c.Int(nullable: false),
                        ClassId = c.Int(nullable: false),
                        IsLeader = c.Boolean(),
                        TeachClassType = c.Int(),
                    })
                .PrimaryKey(t => new { t.TermId, t.UserId, t.StudyId, t.GradeId, t.ClassId });
            
            CreateTable(
                "dbo.T_TeachSet",
                c => new
                    {
                        TermId = c.Int(nullable: false),
                        UserId = c.Int(nullable: false),
                        StudyId = c.Int(nullable: false),
                        GradeId = c.Int(nullable: false),
                    })
                .PrimaryKey(t => new { t.TermId, t.UserId, t.StudyId, t.GradeId });
            
            CreateTable(
                "dbo.T_TeaContacts",
                c => new
                    {
                        CId = c.Int(nullable: false, identity: true),
                        TeaName = c.String(maxLength: 50, unicode: false),
                        TeaPost = c.String(maxLength: 50, unicode: false),
                        ClassId = c.Int(),
                        Tel = c.String(maxLength: 50, unicode: false),
                        Phone = c.String(maxLength: 50, unicode: false),
                        SchoolId = c.Int(),
                    })
                .PrimaryKey(t => t.CId);
            
            CreateTable(
                "dbo.T_TeaGroup",
                c => new
                    {
                        GroupId = c.Int(nullable: false, identity: true),
                        GroupName = c.String(maxLength: 50, unicode: false),
                        AreaCode = c.String(maxLength: 50, unicode: false),
                    })
                .PrimaryKey(t => t.GroupId);
            
            CreateTable(
                "dbo.T_TeaGroup_Member",
                c => new
                    {
                        GroupId = c.Int(nullable: false),
                        UserId = c.Int(nullable: false),
                    })
                .PrimaryKey(t => new { t.GroupId, t.UserId });
            
            CreateTable(
                "dbo.T_Term",
                c => new
                    {
                        TermId = c.Int(nullable: false),
                        TermYear = c.Int(),
                        TermType = c.Int(),
                        TermName = c.String(maxLength: 50),
                        TermBegin = c.DateTime(),
                        TermEnd = c.DateTime(),
                        TermCur = c.Boolean(),
                    })
                .PrimaryKey(t => t.TermId);
            
            CreateTable(
                "dbo.T_TreeGrade",
                c => new
                    {
                        GradeId = c.Int(nullable: false),
                        GradeName = c.String(maxLength: 100),
                        GradeIdNext = c.Int(),
                        StageId = c.Int(),
                    })
                .PrimaryKey(t => t.GradeId);
            
            CreateTable(
                "dbo.T_TreeGradeStudy",
                c => new
                    {
                        GradeId = c.Int(nullable: false),
                        StudyId = c.Int(nullable: false),
                    })
                .PrimaryKey(t => new { t.GradeId, t.StudyId });
            
            CreateTable(
                "dbo.T_TreeLesson",
                c => new
                    {
                        LessonId = c.Int(nullable: false),
                        LessonName = c.String(maxLength: 100),
                        LessonSort = c.Int(),
                        UnitId = c.Int(),
                    })
                .PrimaryKey(t => t.LessonId);
            
            CreateTable(
                "dbo.T_TreeStage",
                c => new
                    {
                        StageId = c.Int(nullable: false),
                        StageName = c.String(maxLength: 100),
                    })
                .PrimaryKey(t => t.StageId);
            
            CreateTable(
                "dbo.T_TreeStudy",
                c => new
                    {
                        StudyId = c.Int(nullable: false),
                        StudyName = c.String(maxLength: 100),
                    })
                .PrimaryKey(t => t.StudyId);
            
            CreateTable(
                "dbo.T_TreeUnit",
                c => new
                    {
                        UnitId = c.Int(nullable: false),
                        UnitName = c.String(maxLength: 100),
                        UnitSort = c.Int(),
                        VolumeId = c.Int(),
                    })
                .PrimaryKey(t => t.UnitId);
            
            CreateTable(
                "dbo.T_TreeVersion",
                c => new
                    {
                        VersionId = c.Int(nullable: false),
                        VersionName = c.String(maxLength: 100),
                    })
                .PrimaryKey(t => t.VersionId);
            
            CreateTable(
                "dbo.T_TreeVolume",
                c => new
                    {
                        VolumeId = c.Int(nullable: false),
                        VolumeName = c.String(maxLength: 100),
                        StageId = c.Int(),
                        StudyId = c.Int(),
                        VersionId = c.Int(),
                    })
                .PrimaryKey(t => t.VolumeId);
            
            CreateTable(
                "dbo.T_TreeVolumeGrade",
                c => new
                    {
                        VolumeId = c.Int(nullable: false),
                        GradeId = c.Int(nullable: false),
                    })
                .PrimaryKey(t => new { t.VolumeId, t.GradeId });
            
            CreateTable(
                "dbo.T_User",
                c => new
                    {
                        UserId = c.Int(nullable: false, identity: true),
                        LoginName = c.String(maxLength: 50, unicode: false),
                        Password = c.String(maxLength: 50, unicode: false),
                        RealName = c.String(maxLength: 50, unicode: false),
                        RoleId = c.Int(nullable: false),
                        Sex = c.Boolean(),
                        CardNo = c.String(maxLength: 20, unicode: false),
                        Phone = c.String(maxLength: 20, unicode: false),
                        Email = c.String(maxLength: 100, unicode: false),
                        UserState = c.Int(),
                        UserFrom = c.Int(),
                        UserAudit = c.Int(),
                        SchoolId = c.Int(nullable: false),
                        GradeId = c.Int(nullable: false),
                        ClassId = c.Int(nullable: false),
                        ScorePlus = c.Decimal(precision: 8, scale: 1),
                        ScoreSub = c.Decimal(precision: 8, scale: 1),
                        ScoreCur = c.Decimal(precision: 8, scale: 1),
                        QrCode = c.String(maxLength: 200, unicode: false),
                        HeadImg = c.String(maxLength: 200, unicode: false),
                        Phone1 = c.String(maxLength: 50, unicode: false),
                        Phone2 = c.String(maxLength: 50, unicode: false),
                        CurDaySendTimes = c.Int(),
                        AreaCode = c.String(maxLength: 10, unicode: false),
                        GroupId = c.Int(),
                    })
                .PrimaryKey(t => t.UserId)
                .ForeignKey("dbo.T_Class", t => t.ClassId, cascadeDelete: true)
                .ForeignKey("dbo.T_TreeGrade", t => t.GradeId, cascadeDelete: true)
                .ForeignKey("dbo.T_Role", t => t.RoleId, cascadeDelete: true)
                .ForeignKey("dbo.T_School", t => t.SchoolId, cascadeDelete: true)
                .Index(t => t.RoleId)
                .Index(t => t.SchoolId)
                .Index(t => t.GradeId)
                .Index(t => t.ClassId);
            
            CreateTable(
                "dbo.T_User_Card",
                c => new
                    {
                        RelId = c.Int(nullable: false, identity: true),
                        UserId = c.Int(nullable: false),
                        CardCode = c.String(nullable: false, maxLength: 100, unicode: false),
                        Remark = c.String(maxLength: 200),
                        OperDate = c.Int(),
                        BindState = c.Int(),
                        CreateTime = c.DateTime(),
                        CreateUserId = c.Int(),
                    })
                .PrimaryKey(t => t.RelId);
            
            CreateTable(
                "dbo.T_UserInvite",
                c => new
                    {
                        UserId = c.Int(nullable: false),
                        InviteCode = c.String(maxLength: 10, unicode: false),
                    })
                .PrimaryKey(t => t.UserId);
            
            CreateTable(
                "dbo.T_WeekPlan",
                c => new
                    {
                        WId = c.Int(nullable: false, identity: true),
                        CreateTime = c.DateTime(),
                        BeginTime = c.DateTime(),
                        EndTime = c.DateTime(),
                        Content = c.String(maxLength: 500),
                        UserId = c.Int(),
                    })
                .PrimaryKey(t => t.WId);
            
            CreateTable(
                "dbo.T_WeekPlan_Img",
                c => new
                    {
                        MId = c.Int(nullable: false, identity: true),
                        WId = c.Int(),
                        ReImg = c.String(maxLength: 200),
                        ReImgPath = c.String(maxLength: 200),
                    })
                .PrimaryKey(t => t.MId);
            
            CreateTable(
                "dbo.T_WeekPlanForClass",
                c => new
                    {
                        WId = c.Int(nullable: false),
                        ClassId = c.Int(nullable: false),
                        SchoolId = c.Int(nullable: false),
                    })
                .PrimaryKey(t => new { t.WId, t.ClassId, t.SchoolId });
            
            CreateTable(
                "dbo.T_WorkList",
                c => new
                    {
                        WorkId = c.Int(nullable: false, identity: true),
                        UserId = c.Int(nullable: false),
                        WorkType = c.Int(nullable: false),
                        CreateTime = c.DateTime(nullable: false),
                        TermId = c.Int(nullable: false),
                        SchoolId = c.Int(),
                        CreateDate = c.Int(),
                        CardCode = c.String(maxLength: 100, unicode: false),
                        Longitude = c.String(maxLength: 50, unicode: false),
                        Latitude = c.String(maxLength: 50, unicode: false),
                        Address = c.String(maxLength: 100, unicode: false),
                    })
                .PrimaryKey(t => t.WorkId);
            
            CreateTable(
                "dbo.V_UserVote",
                c => new
                    {
                        UserVoteId = c.Int(nullable: false, identity: true),
                        VoteListId = c.Int(),
                        VoteOptionId = c.Int(),
                        TimeVote = c.DateTime(),
                        UserId = c.Int(),
                        UserType = c.Int(),
                    })
                .PrimaryKey(t => t.UserVoteId);
            
            CreateTable(
                "dbo.V_VoteList",
                c => new
                    {
                        VoteListId = c.Int(nullable: false, identity: true),
                        VoteTitle = c.String(maxLength: 1000),
                        Suggest = c.String(),
                        TimeBegion = c.DateTime(),
                        TimeEnd = c.DateTime(),
                        SelectNum = c.Int(),
                        VoteType = c.Int(),
                        OpenRange = c.Int(),
                        SchoolId = c.Int(),
                        IsDisplay = c.Int(),
                    })
                .PrimaryKey(t => t.VoteListId);
            
            CreateTable(
                "dbo.V_VoteOption",
                c => new
                    {
                        VoteOptionId = c.Int(nullable: false, identity: true),
                        VoteListId = c.Int(),
                        OptionTitle = c.String(maxLength: 1000),
                        OptionSort = c.Int(),
                    })
                .PrimaryKey(t => t.VoteOptionId);
            
            CreateTable(
                "dbo.W_Chap",
                c => new
                    {
                        ChapId = c.Int(nullable: false, identity: true),
                        ChapName = c.String(maxLength: 100),
                        ChapSort = c.Int(),
                        CourseId = c.Int(),
                    })
                .PrimaryKey(t => t.ChapId);
            
            CreateTable(
                "dbo.W_Course",
                c => new
                    {
                        CourseId = c.Int(nullable: false, identity: true),
                        CourseName = c.String(maxLength: 100),
                        CourseFrom = c.Int(),
                        CourseTypeId = c.Int(),
                        GradeId = c.Int(),
                        StudyId = c.Int(),
                        VersionId = c.Int(),
                        VolumeId = c.Int(),
                        CoursePrice = c.Decimal(precision: 10, scale: 2),
                        CourseImg = c.String(maxLength: 500),
                        CourseDes = c.String(maxLength: 2000),
                        CourseGoal = c.String(maxLength: 2000),
                        CourseRang = c.String(maxLength: 2000),
                        CourseState = c.Int(),
                        CoursePubTime = c.DateTime(),
                        CreateUserId = c.Int(),
                        CreateTime = c.DateTime(),
                        SchoolId = c.Int(),
                    })
                .PrimaryKey(t => t.CourseId);
            
            CreateTable(
                "dbo.W_CourseTeacher",
                c => new
                    {
                        CourseId = c.Int(nullable: false),
                        CourseTeacherId = c.Int(nullable: false),
                    })
                .PrimaryKey(t => new { t.CourseId, t.CourseTeacherId });
            
            CreateTable(
                "dbo.W_FileStar",
                c => new
                    {
                        FileId = c.Int(nullable: false),
                        UserId = c.Int(nullable: false),
                        Star = c.Int(),
                    })
                .PrimaryKey(t => new { t.FileId, t.UserId });
            
            CreateTable(
                "dbo.W_Sect",
                c => new
                    {
                        SectId = c.Int(nullable: false, identity: true),
                        SectName = c.String(maxLength: 100),
                        SectSort = c.Int(),
                        ChapId = c.Int(),
                    })
                .PrimaryKey(t => t.SectId);
            
            CreateTable(
                "dbo.W_SmallFile",
                c => new
                    {
                        FileId = c.Int(nullable: false, identity: true),
                        FileTitle = c.String(maxLength: 400),
                        FileDes = c.String(maxLength: 1000),
                        FileTypeId = c.Int(),
                        FileExtId = c.Int(),
                        FileSize = c.Int(),
                        FilePath = c.String(maxLength: 500),
                        FileCutImg = c.String(maxLength: 500),
                        FileConvert = c.String(maxLength: 500),
                        FileConvertTime = c.DateTime(),
                        VolumeId = c.Int(),
                        UnitId = c.Int(),
                        LessonId = c.Int(),
                        NodeLevel = c.Int(),
                        NodeId = c.Int(),
                        CreateTime = c.DateTime(),
                        CreateUserId = c.Int(),
                        ClickCount = c.Int(),
                        Star = c.Int(),
                        ConvertNum = c.Int(),
                        ConvertHead = c.Int(),
                        FileTitle_LL = c.String(maxLength: 400),
                        FileFrom = c.Int(),
                    })
                .PrimaryKey(t => t.FileId);
            
            CreateTable(
                "dbo.W_Time",
                c => new
                    {
                        TimeId = c.Int(nullable: false, identity: true),
                        TimeName = c.String(maxLength: 100),
                        TimeSort = c.Int(),
                        SectId = c.Int(),
                    })
                .PrimaryKey(t => t.TimeId);
            
            CreateTable(
                "dbo.W_TimeFile",
                c => new
                    {
                        FileId = c.Int(nullable: false, identity: true),
                        FileTitle = c.String(maxLength: 100),
                        FileDes = c.String(maxLength: 1000),
                        FileTypeId = c.Int(),
                        FileExtId = c.Int(),
                        FileSize = c.Int(),
                        FilePath = c.String(maxLength: 500),
                        FileCutImg = c.String(maxLength: 500),
                        FileConvert = c.String(maxLength: 500),
                        FileConvertTime = c.DateTime(),
                        TimeId = c.Int(),
                        CreateTime = c.DateTime(),
                        CreateUserId = c.Int(),
                        ClickCount = c.Int(),
                        Star = c.Int(),
                        ConvertNum = c.Int(),
                        ConvertHead = c.Int(),
                    })
                .PrimaryKey(t => t.FileId);
            
            CreateTable(
                "dbo.Y_Book",
                c => new
                    {
                        BookId = c.Int(nullable: false, identity: true),
                        BookTypeId = c.Int(),
                        BookTitle = c.String(maxLength: 100),
                        AuthorName = c.String(maxLength: 100),
                        TranName = c.String(maxLength: 100),
                        PressName = c.String(maxLength: 100),
                        BookImg = c.String(maxLength: 500),
                        Commend = c.String(maxLength: 2000),
                        AuthorBrief = c.String(maxLength: 2000),
                        ReadGuide = c.String(maxLength: 2000),
                        BookLevel = c.Int(),
                        BookState = c.Int(),
                        CreateUserId = c.Int(),
                        CreateTime = c.DateTime(),
                        ComCnt = c.Int(),
                    })
                .PrimaryKey(t => t.BookId);
            
            CreateTable(
                "dbo.Y_BookExe",
                c => new
                    {
                        ExeId = c.Int(nullable: false, identity: true),
                        ExeType = c.Int(),
                        ExeStem = c.String(),
                        OptionNum = c.Int(),
                        Option1 = c.String(maxLength: 1000),
                        Option2 = c.String(maxLength: 1000),
                        Option3 = c.String(maxLength: 1000),
                        Option4 = c.String(maxLength: 1000),
                        Option5 = c.String(maxLength: 1000),
                        Option6 = c.String(maxLength: 1000),
                        Option7 = c.String(maxLength: 1000),
                        Option8 = c.String(maxLength: 1000),
                        RightAn = c.String(maxLength: 50, unicode: false),
                        BookId = c.Int(),
                    })
                .PrimaryKey(t => t.ExeId);
            
            CreateTable(
                "dbo.Y_BookFile",
                c => new
                    {
                        FileId = c.Int(nullable: false, identity: true),
                        FileName = c.String(maxLength: 100),
                        FileTypeId = c.Int(),
                        FileExtId = c.Int(),
                        FileSize = c.Int(),
                        FilePath = c.String(maxLength: 500),
                        FileCutImg = c.String(maxLength: 500),
                        ConvertPath = c.String(maxLength: 500),
                        ConvertTime = c.DateTime(),
                        ConvertNum = c.Int(),
                        ConvertHead = c.Int(),
                        BookId = c.Int(),
                    })
                .PrimaryKey(t => t.FileId);
            
            CreateTable(
                "dbo.Y_BookGrade",
                c => new
                    {
                        BookId = c.Int(nullable: false),
                        GradeId = c.Int(nullable: false),
                    })
                .PrimaryKey(t => new { t.BookId, t.GradeId });
            
            CreateTable(
                "dbo.Y_BookGradeLevel",
                c => new
                    {
                        BookId = c.String(nullable: false, maxLength: 10, fixedLength: true),
                        GradeLevel = c.String(nullable: false, maxLength: 10, fixedLength: true),
                    })
                .PrimaryKey(t => new { t.BookId, t.GradeLevel });
            
            CreateTable(
                "dbo.Y_ReadLevel",
                c => new
                    {
                        LevelId = c.Int(nullable: false),
                        LevelName = c.String(maxLength: 100),
                        ScoreBegin = c.Decimal(precision: 8, scale: 1),
                        ScoreEnd = c.Decimal(precision: 8, scale: 1),
                    })
                .PrimaryKey(t => t.LevelId);
            
            CreateTable(
                "dbo.Y_ReadScoreRecord",
                c => new
                    {
                        RecordId = c.Int(nullable: false, identity: true),
                        UserId = c.Int(),
                        ScoreFlow = c.Int(),
                        ScoreTypeId = c.Int(),
                        Score = c.Decimal(precision: 8, scale: 1),
                        ScoreCur = c.Decimal(precision: 8, scale: 1),
                        CreateTime = c.DateTime(),
                        RefId = c.Int(),
                        OperUserId = c.Int(),
                    })
                .PrimaryKey(t => t.RecordId);
            
            CreateTable(
                "dbo.Y_Rush",
                c => new
                    {
                        RushId = c.Int(nullable: false, identity: true),
                        UserId = c.Int(),
                        RushType = c.Int(),
                        RushTime = c.DateTime(),
                        FinishState = c.Int(),
                        SuccessState = c.Int(),
                        Score = c.Decimal(precision: 8, scale: 1),
                        BookId = c.Int(),
                    })
                .PrimaryKey(t => t.RushId);
            
            CreateTable(
                "dbo.Y_RushResult",
                c => new
                    {
                        RushId = c.Int(nullable: false),
                        ExeId = c.Int(nullable: false),
                        MyAn = c.String(maxLength: 50, unicode: false),
                        IsRight = c.Boolean(),
                    })
                .PrimaryKey(t => new { t.RushId, t.ExeId });
            
            CreateTable(
                "dbo.Y_Sport",
                c => new
                    {
                        SportId = c.Int(nullable: false, identity: true),
                        BeginTime = c.DateTime(),
                        BookId = c.Int(),
                    })
                .PrimaryKey(t => t.SportId);
            
            CreateTable(
                "dbo.Y_SportExe",
                c => new
                    {
                        SportId = c.Int(nullable: false),
                        ExeId = c.Int(nullable: false),
                    })
                .PrimaryKey(t => new { t.SportId, t.ExeId });
            
            CreateTable(
                "dbo.Y_SportResult",
                c => new
                    {
                        SportId = c.Int(nullable: false),
                        UserId = c.Int(nullable: false),
                        ExeId = c.Int(nullable: false),
                        MyAn = c.String(maxLength: 50, unicode: false),
                        IsRight = c.Boolean(),
                    })
                .PrimaryKey(t => new { t.SportId, t.UserId, t.ExeId });
            
            CreateTable(
                "dbo.Y_SportUser",
                c => new
                    {
                        SportId = c.Int(nullable: false),
                        UserId = c.Int(nullable: false),
                        UserState = c.Int(),
                        SubmitTime = c.DateTime(),
                        WinState = c.Boolean(),
                        Score = c.Decimal(precision: 8, scale: 1),
                    })
                .PrimaryKey(t => new { t.SportId, t.UserId });
            
            CreateTable(
                "dbo.Y_Test",
                c => new
                    {
                        TestId = c.Int(nullable: false, identity: true),
                        TestName = c.String(maxLength: 100),
                        FullScore = c.Decimal(precision: 8, scale: 1),
                        TestLong = c.Int(),
                        TestTimeBegin = c.DateTime(),
                        TestTimeEnd = c.DateTime(),
                        CreateTime = c.DateTime(),
                        CreateUserId = c.Int(),
                        NumStu = c.Int(),
                        NumReal = c.Int(),
                        SchoolId = c.Int(),
                        TermId = c.Int(),
                    })
                .PrimaryKey(t => t.TestId);
            
            CreateTable(
                "dbo.Y_TestExe",
                c => new
                    {
                        TestId = c.Int(nullable: false),
                        ExeId = c.Int(nullable: false),
                    })
                .PrimaryKey(t => new { t.TestId, t.ExeId });
            
            CreateTable(
                "dbo.Y_TestGrade",
                c => new
                    {
                        TestId = c.Int(nullable: false),
                        GradeId = c.Int(nullable: false),
                    })
                .PrimaryKey(t => new { t.TestId, t.GradeId });
            
            CreateTable(
                "dbo.Y_TestResultList",
                c => new
                    {
                        TestId = c.Int(nullable: false),
                        UserId = c.Int(nullable: false),
                        ExeId = c.Int(nullable: false),
                        MyAn = c.String(maxLength: 50, unicode: false),
                        IsRight = c.Boolean(),
                    })
                .PrimaryKey(t => new { t.TestId, t.UserId, t.ExeId });
            
            CreateTable(
                "dbo.Y_TestResultMain",
                c => new
                    {
                        TestId = c.Int(nullable: false),
                        UserId = c.Int(nullable: false),
                        GradeId = c.Int(),
                        ClassId = c.Int(),
                        TestScore = c.Decimal(precision: 8, scale: 1),
                        CreateTime = c.DateTime(),
                    })
                .PrimaryKey(t => new { t.TestId, t.UserId });
            
            CreateTable(
                "dbo.Y_Think",
                c => new
                    {
                        ThinkId = c.Int(nullable: false, identity: true),
                        UserId = c.Int(),
                        GradeId = c.Int(),
                        ClassId = c.Int(),
                        ThinkCnt = c.String(maxLength: 2000),
                        CreateTime = c.DateTime(),
                        BookId = c.Int(),
                    })
                .PrimaryKey(t => t.ThinkId);
            
            CreateTable(
                "dbo.Y_ThinkReplay",
                c => new
                    {
                        ReplyId = c.Int(nullable: false, identity: true),
                        UserId = c.Int(),
                        ReplyCnt = c.String(maxLength: 2000),
                        CreateTime = c.DateTime(),
                        ThinkId = c.Int(),
                    })
                .PrimaryKey(t => t.ReplyId);
            
            CreateTable(
                "dbo.Y_UserLevel",
                c => new
                    {
                        UserId = c.Int(nullable: false),
                        ReadScore = c.Decimal(precision: 8, scale: 1),
                        LevelId = c.Int(),
                    })
                .PrimaryKey(t => t.UserId);
            
        }
        
        public override void Down()
        {
            DropForeignKey("dbo.T_User", "SchoolId", "dbo.T_School");
            DropForeignKey("dbo.T_User", "RoleId", "dbo.T_Role");
            DropForeignKey("dbo.T_User", "GradeId", "dbo.T_TreeGrade");
            DropForeignKey("dbo.T_User", "ClassId", "dbo.T_Class");
            DropForeignKey("dbo.M_MathHomeWorkReceive", "M_MathHomeWorkReceive2_HomeWordReceiveId", "dbo.M_MathHomeWorkReceive");
            DropIndex("dbo.T_User", new[] { "ClassId" });
            DropIndex("dbo.T_User", new[] { "GradeId" });
            DropIndex("dbo.T_User", new[] { "SchoolId" });
            DropIndex("dbo.T_User", new[] { "RoleId" });
            DropIndex("dbo.M_MathHomeWorkReceive", new[] { "M_MathHomeWorkReceive2_HomeWordReceiveId" });
            DropTable("dbo.Y_UserLevel");
            DropTable("dbo.Y_ThinkReplay");
            DropTable("dbo.Y_Think");
            DropTable("dbo.Y_TestResultMain");
            DropTable("dbo.Y_TestResultList");
            DropTable("dbo.Y_TestGrade");
            DropTable("dbo.Y_TestExe");
            DropTable("dbo.Y_Test");
            DropTable("dbo.Y_SportUser");
            DropTable("dbo.Y_SportResult");
            DropTable("dbo.Y_SportExe");
            DropTable("dbo.Y_Sport");
            DropTable("dbo.Y_RushResult");
            DropTable("dbo.Y_Rush");
            DropTable("dbo.Y_ReadScoreRecord");
            DropTable("dbo.Y_ReadLevel");
            DropTable("dbo.Y_BookGradeLevel");
            DropTable("dbo.Y_BookGrade");
            DropTable("dbo.Y_BookFile");
            DropTable("dbo.Y_BookExe");
            DropTable("dbo.Y_Book");
            DropTable("dbo.W_TimeFile");
            DropTable("dbo.W_Time");
            DropTable("dbo.W_SmallFile");
            DropTable("dbo.W_Sect");
            DropTable("dbo.W_FileStar");
            DropTable("dbo.W_CourseTeacher");
            DropTable("dbo.W_Course");
            DropTable("dbo.W_Chap");
            DropTable("dbo.V_VoteOption");
            DropTable("dbo.V_VoteList");
            DropTable("dbo.V_UserVote");
            DropTable("dbo.T_WorkList");
            DropTable("dbo.T_WeekPlanForClass");
            DropTable("dbo.T_WeekPlan_Img");
            DropTable("dbo.T_WeekPlan");
            DropTable("dbo.T_UserInvite");
            DropTable("dbo.T_User_Card");
            DropTable("dbo.T_User");
            DropTable("dbo.T_TreeVolumeGrade");
            DropTable("dbo.T_TreeVolume");
            DropTable("dbo.T_TreeVersion");
            DropTable("dbo.T_TreeUnit");
            DropTable("dbo.T_TreeStudy");
            DropTable("dbo.T_TreeStage");
            DropTable("dbo.T_TreeLesson");
            DropTable("dbo.T_TreeGradeStudy");
            DropTable("dbo.T_TreeGrade");
            DropTable("dbo.T_Term");
            DropTable("dbo.T_TeaGroup_Member");
            DropTable("dbo.T_TeaGroup");
            DropTable("dbo.T_TeaContacts");
            DropTable("dbo.T_TeachSet");
            DropTable("dbo.T_TeachClass");
            DropTable("dbo.T_Synopsis");
            DropTable("dbo.T_StuContacts");
            DropTable("dbo.T_StarBabyType");
            DropTable("dbo.T_StarBabyMsgReceive");
            DropTable("dbo.T_StarBabyMsgFile");
            DropTable("dbo.T_StarBabyMsg");
            DropTable("dbo.T_StandRecord");
            DropTable("dbo.T_Stand");
            DropTable("dbo.T_ScoreType");
            DropTable("dbo.T_ScoreRecordUser");
            DropTable("dbo.T_ScoreRecord");
            DropTable("dbo.T_SchoolTypeStage");
            DropTable("dbo.T_SchoolType");
            DropTable("dbo.T_SchoolStylePhoto");
            DropTable("dbo.T_SchoolStyle");
            DropTable("dbo.T_SchoolBackImg");
            DropTable("dbo.T_School_WorkFun");
            DropTable("dbo.T_School");
            DropTable("dbo.T_Role");
            DropTable("dbo.T_RecrPlan");
            DropTable("dbo.T_Recipes_Img");
            DropTable("dbo.T_Recipes");
            DropTable("dbo.T_Prov");
            DropTable("dbo.T_PostReplyFile");
            DropTable("dbo.T_PostReply");
            DropTable("dbo.T_PostFile");
            DropTable("dbo.T_PostAgree");
            DropTable("dbo.T_Post");
            DropTable("dbo.T_PayOrder");
            DropTable("dbo.T_New");
            DropTable("dbo.T_MsgReplyFile");
            DropTable("dbo.T_MsgReply");
            DropTable("dbo.T_MsgReceive");
            DropTable("dbo.T_MsgFile");
            DropTable("dbo.T_Msg");
            DropTable("dbo.T_MaxId");
            DropTable("dbo.T_ManageSchool");
            DropTable("dbo.T_MakeList");
            DropTable("dbo.T_Leave");
            DropTable("dbo.T_KeyValue");
            DropTable("dbo.T_Journalism");
            DropTable("dbo.T_Group");
            DropTable("dbo.T_FileType");
            DropTable("dbo.T_ClassTerm");
            DropTable("dbo.T_ClassStudent");
            DropTable("dbo.T_ClassGroupStudent");
            DropTable("dbo.T_ClassGroup");
            DropTable("dbo.T_Class");
            DropTable("dbo.T_City");
            DropTable("dbo.T_CashRecord");
            DropTable("dbo.T_CashMat");
            DropTable("dbo.T_AwardRecord");
            DropTable("dbo.T_AwardMat");
            DropTable("dbo.T_Area");
            DropTable("dbo.T_AppTicket");
            DropTable("dbo.T_AppModelOpen");
            DropTable("dbo.T_App");
            DropTable("dbo.R_MatType");
            DropTable("dbo.R_MatTeaIsCheck");
            DropTable("dbo.R_MatTeaCheck");
            DropTable("dbo.R_MatSetCheck");
            DropTable("dbo.R_MatSchoolFTP");
            DropTable("dbo.R_MatForum");
            DropTable("dbo.R_MatFileExt");
            DropTable("dbo.R_MatFile");
            DropTable("dbo.R_MatCollection");
            DropTable("dbo.R_MatCheckList");
            DropTable("dbo.R_LiveRoom");
            DropTable("dbo.R_LiveCourse");
            DropTable("dbo.M_MathLevel");
            DropTable("dbo.M_MathHomeWorkResult");
            DropTable("dbo.M_MathHomeWorkReceive");
            DropTable("dbo.M_MathHomeWork");
            DropTable("dbo.M_MathExeType");
            DropTable("dbo.M_MathExercise");
            DropTable("dbo.C_TestList");
            DropTable("dbo.C_TestError");
            DropTable("dbo.C_Test");
            DropTable("dbo.C_PaperExe");
            DropTable("dbo.C_Paper");
            DropTable("dbo.C_Exe");
        }
    }
}
